import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

import 'dart:math' as math;

class TagWidget extends MultiChildRenderObjectWidget {

  @override
  RenderObject createRenderObject(BuildContext context) {
    return RenderTag();
  }

}

class RenderTag extends RenderBox with ContainerRenderObjectMixin<RenderBox, WrapParentData>,
RenderBoxContainerDefaultsMixin<RenderBox, WrapParentData> {

  @override
  double computeMaxIntrinsicWidth(double height) {
    double width = 0.0;
    RenderBox child = firstChild;
    while (child != null) {
      width = math.max(width, child.getMinIntrinsicWidth(double.infinity));
      child = childAfter(child);
    }
    return width;
  }

}